package com.zhangsheng.sentinel.fallback;

import com.zhangsheng.api.CommonResult;
import com.zhangsheng.entity.model.Order;
import com.zhangsheng.entity.model.Product;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author 张晟
 * @version 1.0
 * @date 2023/2/22 12:54
 */
@Slf4j
public class MysqlServiceFallBack {

    public static CommonResult<Order> getOrderByIdFallback(Integer orderId) {
        log.error("访问资源getOrderById fallback，orderId={}", orderId);
        return CommonResult.failed("请稍后重试");
    }
    public static CommonResult<Order> createOrderFallback(Order order) {
        log.error("访问资源createOrderWithMq fallback，order={}", order);
        return CommonResult.failed("请稍后重试");
    }
    public static CommonResult<Product> masterAddFallback(Product product) {
        log.error("访问资源masterAdd fallback，product={}", product);
        return CommonResult.failed("请稍后重试");
    }

    public static CommonResult<Product> getSlave1Fallback(Integer id) {
        log.error("访问资源getSlave1 fallback，id={}", id);
        return CommonResult.failed("请稍后重试");
    }

    public static CommonResult<Product> getSlave2Fallback(Integer id) {
        log.error("访问资源getSlave2 fallback，id={}", id);
        return CommonResult.failed("请稍后重试");
    }

    public static CommonResult<List<Order>> getOrderByPageFallback(Integer pageNum , Integer pageSize) {
        log.error("访问资源getByPage fallback，pageNum={}，pageSize={}", pageNum, pageSize);
        return CommonResult.failed("请稍后重试");
    }

}
